package com.codemonkey.lq.extend.excelverification.result;

import java.util.ArrayList;
import java.util.List;

public class VerifyRowResult {

	private final int index;

	public VerifyRowResult(int index) {
		super();
		this.index = index;
	}

	private List<VerifyCellResult> list = new ArrayList<VerifyCellResult>();

	public void addVerifyCellResult(VerifyCellResult verifyCellResult) {
		list.add(verifyCellResult);
	}

	public int getIndex() {
		return index;
	}

	public String getDetail() {
		StringBuilder sb = new StringBuilder("##row index[ ");
		sb.append(index).append(" ] :").append(System.lineSeparator());

		for (VerifyCellResult vcr : list) {
			sb.append(vcr.getDetail());
			sb.append(System.lineSeparator());
		}

		return sb.toString();
	}

	public String getPrompt() {
		StringBuilder sb = new StringBuilder("###row index[ ");
		sb.append(index).append(" ] :").append(System.lineSeparator());

		for (VerifyCellResult vcr : list) {
			sb.append(vcr.getPrompt());
			if (vcr.isPass()) {
				continue;
			}
			sb.append(System.lineSeparator());
		}

		return sb.toString();
	}
}
